package com.wn.servlet.demo02;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author yellow Docter
 * @date 2022 -06-28
 * @desc
 *
 * @WebServlet 注解:
 *    urlPatterns: url 和 Path01Servlet 进行关联 通过url找到 Path01Servlet处理请求
 *
 * urlPatterns 的字符串写法有多种方式:
 *  01  精确匹配       /path1  只有这个url才可以
 *  02  扩展名匹配     *.action  如果以后缀action 都可以配置到servlet   通配符 *
 *  03  通配符匹配     /*       任何请求都可以访问
 *                    \/*\/abc 这个写法是错误的
 *
 */
//@WebServlet(urlPatterns = {"/path1","/path2"})
//@WebServlet(urlPatterns = "*.action")
//@WebServlet(urlPatterns = "/*")
public class Path01Servlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("Path01Servlet.doGet");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
